package exttable.login;

import exttable.formgenerator.FormGenerator;
import exttable.formgenerator.ViewGenerator;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;


/**
 * Created by IntelliJ IDEA.
 * User: ADMIN
 * Date: 07.04.2010
 * Time: 14:46:53
 * To change this template use File | Settings | File Templates.
 */
public class InsertFormPanel {

    public InsertFormPanel(){
        JFrame jf=new JFrame();
        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JPanel panel=new JPanel();
        JButton addVolunteer=new JButton("add volunteer");
        addVolunteer.setName("volunteers");
        addVolunteer.addActionListener(new ActionListener(){
                @Override
                 public void actionPerformed(ActionEvent e){
                    JButton but=(JButton) e.getSource();

                    new FormGenerator(but.getName(), null);


                  }


        });
           JButton viewVolunteers=new JButton("view volunteers");
        viewVolunteers.setName("volunteers");

        viewVolunteers.addActionListener(new ActionListener(){
                @Override
                 public void actionPerformed(ActionEvent e){
                    JButton but=(JButton) e.getSource();
                    //System.out.println("but.getName() = "+but.getName());
                    //new FormGenerator(but.getName());
                    new ViewGenerator(but.getName());


                  }
        });

        //////////////////////////////////////////////////

        ////////////////////////////////////////////////////
        JButton addProbationer=new JButton("add probationer");
        addProbationer.setName("probationers");
        addProbationer.addActionListener(new ActionListener(){
                @Override
                 public void actionPerformed(ActionEvent e){
                    JButton but=(JButton) e.getSource();

                    new FormGenerator(but.getName(), null);


                  }


        });
           JButton viewProbationers=new JButton("view probationers");
        viewProbationers.setName("probationers");

        viewProbationers.addActionListener(new ActionListener(){
                @Override
                 public void actionPerformed(ActionEvent e){
                    JButton but=(JButton) e.getSource();
                    //System.out.println("but.getName() = "+but.getName());
                    //new FormGenerator(but.getName());
                    new ViewGenerator(but.getName());


                  }
        });

        //////////////////////////////////////////////////
        JButton addGroup=new JButton("add group");
        addGroup.setName("formgenerator");
        addGroup.addActionListener(new ActionListener(){
                @Override
                 public void actionPerformed(ActionEvent e){
                    JButton but=(JButton) e.getSource();
                    //System.out.println("but.getName() = "+but.getName());
                    new FormGenerator(but.getName(), null);


                  }
        });

           JButton viewGroups=new JButton("view formgenerator");
        viewGroups.setName("formgenerator");
        viewGroups.addActionListener(new ActionListener(){
                @Override
                 public void actionPerformed(ActionEvent e){
                    JButton but=(JButton) e.getSource();
                    //System.out.println("but.getName() = "+but.getName());
                    //new FormGenerator(but.getName());
                    new ViewGenerator(but.getName());


                  }
        });

        panel.add(addVolunteer);
        panel.add(viewVolunteers);
        panel.add(addProbationer);
        panel.add(viewProbationers);
        panel.add(addGroup);
        panel.add(viewGroups);
        jf.add(panel);
        jf.setVisible(true);
        jf.pack();

    }


//    public static void main(String[]args){
//             new InsertFormPanel();
//    }
}
